<template>
  <el-form :inline="true" :model="formInline" ref="formInlineRef" size="mini">
    <el-form-item label="分类名称" prop="user">
      <el-input
        v-model="formInline.user"
        placeholder="请输入分类名称"
      ></el-input>
    </el-form-item>
    <el-form-item label="状态" prop="status">
      <el-select
        v-model="formInline.status"
        placeholder="请选择"
        style="width:90px"
      >
        <el-option
          :label="item.title"
          :value="item.val"
          v-for="item in options"
          :key="item.val"
        ></el-option>
      </el-select>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="findList" icon="el-icon-search"
        >查询</el-button
      >
      <el-button @click="resetForm" icon="el-icon-refresh">重置</el-button>
      <el-button
        type="primary"
        @click="addDialog"
        icon="el-icon-circle-plus-outline"
        >新增</el-button
      >
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  data() {
    return {
      formInline: {
        user: "",
        status: ""
      },
      options: [
        { val: 0, title: "禁用" },
        { val: 1, title: "正常" }
      ]
    };
  },
  methods: {
    // 查询
    findList() {
      this.$emit("findList", this.formInline);
    },
    // 重置
    resetForm() {
      this.$refs.formInlineRef.resetFields();
    },
    // 新增
    addDialog() {
      this.$emit("addDialog", true);
    }
  }
};
</script>

<style scoped></style>
